Open
Conversation
48f1507 to
3749c93
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class “multi-target” support to Olive so a single workflow can produce and package multiple context-binary variants (e.g., multiple QNN SoCs or multiple OpenVINO versions) under one logical model.
Changes:
- Introduces
MultiTargetModelHandlerand pass-level auto-dispatch for passes that don’t natively accept multi-target models. - Extends context-binary generation passes (QNN + OpenVINO encapsulation) to emit multi-target outputs and persist relevant metadata in
model_attributes. - Adds packaging utilities:
ModelPackagerpass (manifest generation) and a newolive model-packageCLI command (merge multiple single-target outputs).
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| test/passes/openvino/test_openvino_encapsulation.py | Adds tests for OpenVINO encapsulation multi-target behavior. |
| test/passes/onnx/test_multi_target_context_binary.py | Adds tests for ModelPackager and generic multi-target pass dispatch. |
| test/passes/onnx/test_context_binary.py | Adds multi-target tests for EPContextBinaryGenerator. |
| test/model/test_multi_target_model.py | Adds unit tests for MultiTargetModelHandler JSON + attribute behavior. |
| test/cli/test_model_package.py | Adds tests for new olive model-package command. |
| olive/systems/system_config.py | Pydantic serialization adjustment for system config (SerializeAsAny). |
| olive/passes/openvino/optimum_intel.py | Adds TMPDIR/tempdir workaround + improved exception chaining. |
| olive/passes/openvino/encapsulation.py | Adds OpenVINO multi-target encapsulation and metadata population. |
| olive/passes/onnx/model_packager.py | New pass to generate manifest.json for multi-target packages. |
| olive/passes/onnx/model_builder.py | Improves ImportError chaining. |
| olive/passes/onnx/context_binary.py | Adds QNN multi-target provider-options support + metadata population. |
| olive/passes/olive_pass.py | Adds _accepts_multi_target_model and multi-target auto-dispatch in Pass.run. |
| olive/olive_config.json | Registers new ModelPackager pass. |
| olive/model/handler/multi_target.py | New MultiTargetModelHandler implementation. |
| olive/model/handler/init.py | Exposes MultiTargetModelHandler from handler package. |
| olive/engine/engine.py | Changes output path handling for artifacts directory selection. |
| olive/cli/optimize.py | Updates excluded node name for a quantization-related config. |
| olive/cli/model_package.py | New CLI command to merge outputs into a multi-target package manifest. |
| olive/cli/launcher.py | Registers model-package subcommand. |
| olive/cache.py | Adds save logic for multi-target cached models + changes output path handling. |
d357f93 to
397923c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for a new "Model Package" feature, which enables handling and packaging multiple model variants (e.g., for different hardware targets or deployment configurations) as a single logical unit. It adds a new
ModelPackageModelHandler, a corresponding CLI command, and extends the pass system to recognize and process model packages. Several parts of the codebase are updated to support this new functionality, including improvements to file handling and documentation.Model Package Support
ModelPackageModelHandlerinolive/model/handler/model_package.py, allowing the management of multiple deployment variants of the same model as a single package. This handler enforces that all variants are of the same type and provides utilities for serialization and variant iteration.ModelPackageModelHandlerin the model handler registry and__init__.pyto make it available throughout Olive. [1] [2]ModelPackagepass to the configuration and documentation, supporting the creation and management of model packages. [1] [2]generate-model-package) for model package operations and updated documentation to describe its usage. [1] [2] [3]Pass System Enhancements
Passbase class to add_accepts_model_package_modeland_skip_additional_files_carry_forwardflags, enabling passes to control how model packages are processed and how files are handled.ModelPackageModelHandler. [1] [2]EPContextBinaryGeneratorpass to optionally generate context binaries for multiple provider options and return a model package when a list of options is provided. [1] [2] [3]Model and File Handling Improvements
save_modelinolive/cache.pyto properly save model packages, copying only relevant subdirectories and updating paths and manifest information accordingly.engine.pyto better distinguish between file and directory outputs, ensuring correct artifact placement for model packages. [1] [2]Miscellaneous
optimize.py.These changes collectively enable Olive to support advanced deployment workflows where a single model package can encapsulate multiple optimized variants, streamlining model management and deployment for heterogeneous environments.
ORT reference: microsoft/onnxruntime#27786